<template>
  <div>
    <swiper :list="swiperList" height="70vh"></swiper>
    <div class="card m-15 flex p-10">
      <div class="my_card_l">
        <div class="my_integral">我的魅力点 x {{ integral }}</div>
        <div class="mt-5 flex">
          <div class="code_circular mr-10" v-for="item in 5" :key="item"></div>
          <div class="code_circular mr-10 flex x_y_center float_r">
            <div class="spot" v-for="index in 3" :key="index"></div>
          </div>
        </div>
        <div class="text_p mt-5">提示信息...</div>
      </div>
      <div class="my_card_r ml-10 x_y_center">
        <div @click="vanImagePreview(vipImg)">
          <img :src="vipImg" alt="" class="QR_code" />
          <div class="vipCode">会员码</div>
        </div>
      </div>
    </div>
    <div class="flex m-15">
      <div class="shop card p-20 pl-15 pr-15 x_y_center">
        <div @click="($router.push('/list'),$emit('update:routes', 'list'))">
          <img src="https://s.im5i.com/2021/06/19/aftZM.md.jpg" alt="" class="shop_img" />
          <div class="shop_code mt-10">第六感小店</div>
        </div>
      </div>
      <div class="shop_r ml-10">
        <div class="card p-10 flex1 x_y_center">
          <div>
            <img
              src="https://s.im5i.com/2021/06/19/aftZM.md.jpg"
              alt=""
              class="shop_img"
            />
            <div class="shop_code txt_center mt-10">会员充值</div>
          </div>
        </div>
        <div class="card p-10 flex1 x_y_center mt-10">
          <div>
            <img
              src="https://e.im5i.com/2021/07/29/t8bFG.png" 
              alt=""
              class="shop_img"
            />
            <div class="shop_code txt_center mt-10">加入我们</div>
          </div>
        </div>
      </div>
    </div>
    <van-image-preview />
  </div>
</template>

<script>
import swiper from "@/components/Swiper";
import { reactive, toRefs } from "vue";
import { ImagePreview } from 'vant';
export default {
  name: "home",
  components: {
    swiper,
  },
  props: {
    routes: {
      type: String,
      required: true,
    },
  },
  setup() {
    const state = reactive({ 
      swiperList: [
          {
            imgUrl: "https://newbee-mall.oss-cn-beijing.aliyuncs.com/images/banner-mate40.png",
          },
          {
            imgUrl: "https://newbee-mall.oss-cn-beijing.aliyuncs.com/images/banner1.png",
          },
          {
            imgUrl: "https://newbee-mall.oss-cn-beijing.aliyuncs.com/images/banner2.png",
          },
        ], // 轮播图列表
      integral: 2,
      vipImg:'https://e.im5i.com/2021/09/29/mXAwf.png',
    });
    const vanImagePreview = (img)=>{
      ImagePreview({
        images: [img],
        overlayStyle:{
          zIndex:9999,
        }
      });
    }
    return {
      ...toRefs(state),
      vanImagePreview,
    };
  },
};
</script>

<style lang="less" scoped>
.my_card_l {
  border-right: 1px solid #797979;
  width: calc(100% - 65px);
  .my_integral {
    font-size: 16px;
  }
  .code_circular {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #797979;
    .spot {
      width: 5px;
      height: 5px;
      background: #000;
      border-radius: 50%;
    }
    .spot + .spot {
      margin-left: 3px;
    }
  }
  .text_p {
    color: #ccc;
    overflow: hidden;
    /* //超出隐藏 */
    text-overflow: ellipsis;
    /* //超出文本设置为... */
    display: -webkit-box;
    /* //将div1转换为盒子模型 */
    -webkit-line-clamp: 1;
    /* //设置div1的文本为2行 */
    -webkit-box-orient: vertical;
  }
}
.my_card_r {
  min-width: 65px;
  .QR_code {
    width: 50px;
    height: 50px;
  }
  .vipCode {
    text-align: center;
  }
}
.shop {
  width: 65%;
  .shop_img {
    height: 100px;
    width: 100%;
  }
  .shop_code {
    text-align: center;
    font-family: "楷体";
    font-size: 30px;
  }
}
.shop_r {
  width: 33%;
  display: flex;
  flex-direction: column;
  div img {
    height: 50px;
    width: 100%;
  }
}
</style>
